package thread.synchronize_base;

/**
 * Created by mHandler on 2018/5/28 0028.
 * Description:
 */
public class HasSelfPrivateNum {
    private int num = 0;

    synchronized public void addI(String username){
        try {
            if (username.equals("a")){
                num = 100;
                System.out.println("a set over");
                Thread.sleep(2000);
            }else {
                num = 200;
                System.out.println("b set over");
            }
            System.out.println(username + "=" + num);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
